Skip to content

refactor(astutils): remove redundant nil check in Walk#2660

Merged
kyleconroy merged 1 commit intosqlc-dev:mainfrom
Juneezee:main
Aug 28, 2023
Merged

refactor(astutils): remove redundant nil check in Walk#2660
kyleconroy merged 1 commit intosqlc-dev:mainfrom
Juneezee:main

Conversation

@Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Aug 26, 2023

From the Go docs:

"For a nil slice, the number of iterations is 0." https://go.dev/ref/spec#For_range

Therefore, an additional nil check for before the loop is unnecessary. Example: https://go.dev/play/p/tMQ9JcUOMcI

From the Go docs:

  "For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@kyleconroy kyleconroy merged commit ecf4980 into sqlc-dev:main Aug 28, 2023
alfonsodev pushed a commit to ExponentiaTeam/sqlc that referenced this pull request Oct 13, 2025
From the Go docs:

  "For a nil slice, the number of iterations is 0." [1]

Therefore, an additional nil check for before the loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants